import pandas as pd
import numpy as np

df1 = pd.DataFrame({
    '学号': [2002101, 2002102, 2002103],
    '姓名': ['文远', '于敏', '方瑶'],
    '年龄': [22, 21, 21],
    '性别': pd.Categorical(['男', '女', '女'])
})

df1 = df1.set_index('学号')

print(df1)

df1.to_excel('xueshen.xlsx',sheet_name='测试页')
